//
//  HLLoginInfoFieldView.m
//  YueYue
//
//  Created by hulu001 on 2023/5/24.
//

#import "HLLoginInfoFieldView.h"

@implementation HLLoginInfoFieldView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
        
    }
    return self;
}

- (void)setupView {
    
    self.titleLabel = [[UILabel alloc] qmui_initWithFont:UIFontMake(14) textColor:HLTextColor2];
    _titleLabel.text = @"昵称";
    [self addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(4);
        make.right.mas_equalTo(-4);
    }];
    
    self.textField = [[QMUITextField alloc] init];
    _textField.placeholder = @"请输入昵称";
    _textField.font = UIFontMake(16);
    _textField.textColor = HLTextColor1;
    _textField.backgroundColor = UIColorWhite;
    _textField.layer.borderWidth = 2;
    _textField.layer.borderColor = HLLineColor.CGColor;
    _textField.layer.masksToBounds = YES;
    _textField.layer.cornerRadius = 12;
    _textField.textInsets = UIEdgeInsetsMake(0, 16, 0, 16);
    [self addSubview:_textField];
    [_textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.equalTo(_titleLabel.mas_bottom).offset(4);
        make.bottom.mas_equalTo(-4);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH-48, 50));
    }];
    
    self.button = [[QMUIButton alloc] init];
    [_button setTitleColor:HLTextColor1 forState:UIControlStateNormal];
    [_button.titleLabel setFont:UIFontMake(13)];
    _button.imagePosition = QMUIButtonImagePositionLeft;
    _button.spacingBetweenImageAndTitle = 4;
    [self addSubview:_button];
    [_button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(_textField).offset(-16);
        make.centerY.equalTo(_textField);
        make.height.mas_equalTo(46);
        make.width.mas_lessThanOrEqualTo(50);
    }];
    
}

@end
